

<!DOCTYPE html>
<html lang="zh-CN" data-default-color-scheme=&#34;auto&#34;>



<head>
  <meta charset="UTF-8">
  <link rel="apple-touch-icon" sizes="76x76" href="/img/notebook.ico">
  <link rel="icon" href="/img/notebook.ico">
  <meta name="viewport"
        content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, shrink-to-fit=no">
  <meta http-equiv="x-ua-compatible" content="ie=edge">
  
  <meta name="theme-color" content="#2f4154">
  <meta name="description" content="">
  <meta name="author" content="John Doe">
  <meta name="keywords" content="">
  
  <title>深入理解 synchronized 原理 - xulinglin</title>

  <link  rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.6.0/dist/css/bootstrap.min.css" />


  <link  rel="stylesheet" href="https://cdn.jsdelivr.net/npm/github-markdown-css@4.0.0/github-markdown.min.css" />
  <link  rel="stylesheet" href="/lib/hint/hint.min.css" />

  
    
    
      
      <link  rel="stylesheet" href="https://cdn.jsdelivr.net/npm/highlight.js@10.7.2/styles/monokai-sublime.min.css" />
    
  

  
    <link  rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fancyapps/fancybox@3.5.7/dist/jquery.fancybox.min.css" />
  



<!-- 主题依赖的图标库，不要自行修改 -->

<link rel="stylesheet" href="//at.alicdn.com/t/font_1749284_ba1fz6golrf.css">



<link rel="stylesheet" href="//at.alicdn.com/t/font_1736178_kmeydafke9r.css">


<link  rel="stylesheet" href="/css/main.css" />

<!-- 自定义样式保持在最底部 -->

  
<link rel="stylesheet" href="/css/diy/shubiao.css">
<link rel="stylesheet" href="//cdn.jsdelivr.net/gh/bynotes/texiao/source/css/toubudaziji.css">



  <script id="fluid-configs">
    var Fluid = window.Fluid || {};
    var CONFIG = {"hostname":"example.com","root":"/","version":"1.8.11","typing":{"enable":true,"typeSpeed":70,"cursorChar":"","loop":false},"anchorjs":{"enable":true,"element":"h1,h2,h3,h4,h5,h6","placement":"right","visible":"hover","icon":""},"progressbar":{"enable":true,"height_px":3,"color":"#29d","options":{"showSpinner":false,"trickleSpeed":100}},"copy_btn":true,"image_zoom":{"enable":true,"img_url_replace":["",""]},"toc":{"enable":true,"headingSelector":"h1,h2,h3,h4,h5,h6","collapseDepth":0},"lazyload":{"enable":true,"loading_img":"/img/loading.gif","onlypost":false,"offset_factor":2},"web_analytics":{"enable":false,"baidu":null,"google":null,"gtag":null,"tencent":{"sid":null,"cid":null},"woyaola":null,"cnzz":null,"leancloud":{"app_id":null,"app_key":null,"server_url":null}},"search_path":"/local-search.xml"};
  </script>
  <script  src="/js/utils.js" ></script>
  <script  src="/js/color-schema.js" ></script>
<meta name="generator" content="Hexo 5.4.0"></head>


<body>
  <header style="height: 30vh;">
    <nav id="navbar" class="navbar fixed-top  navbar-expand-lg navbar-dark scrolling-navbar">
  <div class="container">
    <a class="navbar-brand"
       href="/">&nbsp;<strong>笑语</strong>&nbsp;</a>

    <button id="navbar-toggler-btn" class="navbar-toggler" type="button" data-toggle="collapse"
            data-target="#navbarSupportedContent"
            aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
      <div class="animated-icon"><span></span><span></span><span></span></div>
    </button>

    <!-- Collapsible content -->
    <div class="collapse navbar-collapse" id="navbarSupportedContent">
      <ul class="navbar-nav ml-auto text-center">
        
          
          
          
          
            <li class="nav-item">
              <a class="nav-link" href="/">
                <i class="iconfont icon-home-fill"></i>
                首页
              </a>
            </li>
          
        
          
          
          
          
            <li class="nav-item">
              <a class="nav-link" href="/archives/">
                <i class="iconfont icon-archive-fill"></i>
                目录
              </a>
            </li>
          
        
          
          
          
          
            <li class="nav-item">
              <a class="nav-link" href="/categories/">
                <i class="iconfont icon-category-fill"></i>
                分类
              </a>
            </li>
          
        
          
          
          
          
            <li class="nav-item">
              <a class="nav-link" href="/tags/">
                <i class="iconfont icon-tags-fill"></i>
                标签
              </a>
            </li>
          
        
          
          
          
          
            <li class="nav-item">
              <a class="nav-link" href="/about/">
                <i class="iconfont icon-user-fill"></i>
                关于
              </a>
            </li>
          
        
        
          <li class="nav-item" id="search-btn">
            <a class="nav-link" target="_self" data-toggle="modal" data-target="#modalSearch">&nbsp;<i
                class="iconfont icon-search"></i>&nbsp;</a>
          </li>
        
        
          <li class="nav-item" id="color-toggle-btn">
            <a class="nav-link" target="_self">&nbsp;<i
                class="iconfont icon-dark" id="color-toggle-icon"></i>&nbsp;</a>
          </li>
        
      </ul>
    </div>
  </div>
</nav>

    <div class="banner" id="banner" parallax=true
         style="background: url('/img/img_1.jpg') no-repeat center center;
           background-size: cover;">
      <div class="full-bg-img">
        <div class="mask flex-center" style="background-color: rgba(0, 0, 0, 0.5)">
          <div class="page-header text-center fade-in-up">
            <span class="h2" id="subtitle" title="深入理解 synchronized 原理">
              
            </span>

            
              <div class="mt-3">
  
  
    <span class="post-meta">
      <i class="iconfont icon-date-fill" aria-hidden="true"></i>
      <time datetime="2021-06-04 13:55" pubdate>
        2021年6月4日 下午
      </time>
    </span>
  
</div>

<div class="mt-1">
  
    
    <span class="post-meta mr-2">
      <i class="iconfont icon-chart"></i>
      1.4k 字
    </span>
  

  
    
    <span class="post-meta mr-2">
      <i class="iconfont icon-clock-fill"></i>
      
      
      17
       分钟
    </span>
  

  
  
</div>

            
          </div>

          
        </div>
      </div>
    </div>
  </header>

  <main>
    
      

<div class="container-fluid nopadding-x">
  <div class="row nomargin-x">
    <div class="d-none d-lg-block col-lg-2"></div>
    <div class="col-lg-8 nopadding-x-md">
      <div class="container nopadding-x-md" id="board-ctn">
        <div class="py-5" id="board">
          <article class="post-content mx-auto">
            <!-- SEO header -->
            <h1 style="display: none">深入理解 synchronized 原理</h1>
            
            <div class="markdown-body">
              <span class="label label-primary">Synchronized</span> 是一种JVM锁,大部分人都只是会使用 <span class="label label-primary">Synchronized</span>  关键子,在方法上加入 <span class="label label-primary">Synchronized</span>  就能对共享变量进行线程安全的使用,确没有了解 <span class="label label-primary">Synchronized</span>  大部分真正含义,如,<span class="label label-primary">Synchronized</span>  锁的级别,锁的范围(使用不同的对象,锁的范围不同)。希望下文对各位有所帮助。

<h2 id="1-Synchronized使用"><a href="#1-Synchronized使用" class="headerlink" title="1. Synchronized使用"></a>1. Synchronized使用</h2><h3 id="1-1-修饰实例方法"><a href="#1-1-修饰实例方法" class="headerlink" title="1.1. 修饰实例方法"></a>1.1. 修饰实例方法</h3><div class="hljs code-wrapper"><pre><code class="hljs Java"><span class="hljs-keyword">public</span> <span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">SynchronizedTest</span> </span>&#123;
    <span class="hljs-keyword">int</span> i = <span class="hljs-number">0</span>;
    <span class="hljs-function"><span class="hljs-keyword">public</span> <span class="hljs-keyword">synchronized</span> <span class="hljs-keyword">void</span> <span class="hljs-title">monitor</span><span class="hljs-params">()</span></span>&#123;
        i++;
    &#125;
    <span class="hljs-function"><span class="hljs-keyword">public</span> <span class="hljs-keyword">synchronized</span> <span class="hljs-keyword">void</span> <span class="hljs-title">monitor1</span><span class="hljs-params">()</span></span>&#123;
        i++;
    &#125;
    <span class="hljs-function"><span class="hljs-keyword">public</span> <span class="hljs-keyword">static</span> <span class="hljs-keyword">void</span> <span class="hljs-title">main</span><span class="hljs-params">(String[] args)</span> </span>&#123;
        SynchronizedTest test = <span class="hljs-keyword">new</span> SynchronizedTest();
        <span class="hljs-keyword">new</span> Thread(()-&gt;&#123; 
            test.monitor(); 
        &#125;).start();
        <span class="hljs-keyword">new</span> Thread(()-&gt;&#123; 
            test.monitor1(); 
        &#125;).start();
    &#125;
&#125;</code></pre></div>

<p>上面代码我们在 <span class="label label-primary">SynchronizedTest</span> 类中有 <span class="label label-primary">monitor()</span> 以及 <span class="label label-primary">monitor1()</span> 两个方法.<br>分别都加了一个 <span class="label label-primary">synchronized</span> 两个方法都操作了一个 int 为 i 的共享变量,看<span class="label label-primary">main</span>方法比如有两个线程, 线程A访问 <span class="label label-primary">monitor()</span> 线程B访问 <span class="label label-primary">monitor1()</span> 都是用的 test对象进行调用的,此时我们的 锁的范围 当前 test对象。</p>
<p class="note note-info">
修饰实例方法，作用于当前实例加锁，进入同步代码前要获得当前实例的锁。同一Class类不同的实例对象锁的范围,已对象为单位
</p>

<h3 id="1-2-静态对象"><a href="#1-2-静态对象" class="headerlink" title="1.2. 静态对象"></a>1.2. 静态对象</h3><div class="hljs code-wrapper"><pre><code class="hljs Java"><span class="hljs-keyword">public</span> <span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">SynchronizedTest</span> </span>&#123;
    <span class="hljs-keyword">static</span> <span class="hljs-keyword">int</span> i = <span class="hljs-number">0</span>;
    <span class="hljs-function"><span class="hljs-keyword">public</span> <span class="hljs-keyword">synchronized</span> <span class="hljs-keyword">void</span> <span class="hljs-title">monitor</span><span class="hljs-params">()</span></span>&#123;
        i++;
    &#125;
    <span class="hljs-function"><span class="hljs-keyword">public</span> <span class="hljs-keyword">static</span> <span class="hljs-keyword">synchronized</span>  <span class="hljs-keyword">void</span> <span class="hljs-title">monitor1</span><span class="hljs-params">()</span></span>&#123;
        i++;
    &#125;
    <span class="hljs-function"><span class="hljs-keyword">public</span> <span class="hljs-keyword">static</span> <span class="hljs-keyword">void</span> <span class="hljs-title">main</span><span class="hljs-params">(String[] args)</span> </span>&#123;
        SynchronizedTest test = <span class="hljs-keyword">new</span> SynchronizedTest();
        <span class="hljs-keyword">new</span> Thread(()-&gt;&#123;
            test.monitor();
        &#125;).start();
        <span class="hljs-keyword">new</span> Thread(()-&gt;&#123;
            SynchronizedTest.monitor1();
        &#125;).start();
    &#125;
&#125;</code></pre></div>

<p>上面代码我们在 <span class="label label-primary">SynchronizedTest</span> 类中有 <span class="label label-primary">monitor()</span> 以及 <span class="label label-primary">monitor1()</span> 两个方法.<br>分别都加了一个 <span class="label label-primary">synchronized</span> 两个方法都操作了一个 static int 为 i 的共享变量,看main方法比如有两个线程, 线程A访问 <span class="label label-primary">test.monitor()</span>,线程B访问 <span class="label label-primary">SynchronizedTest.monitor1()</span>,main运行肯定是线程不安全的,两个方法都加了 <span class="label label-primary">synchronized</span> 但是锁的对象不同,一个是实例对象,一个是静态对象</p>
<p class="note note-info">
修饰静态方法，作用于当前类对象加锁，进入同步代码前要获得当前类对象的锁。静态变量为全局唯一的,所有对象在锁静态对象时间单位为Class。不同的对象使用静态变量为锁时,所有对象使用的是同一吧锁
</p>

<h3 id="1-3-代码块"><a href="#1-3-代码块" class="headerlink" title="1.3. 代码块"></a>1.3. 代码块</h3><div class="hljs code-wrapper"><pre><code class="hljs Java"><span class="hljs-keyword">public</span> <span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">SynchronizedTest</span> </span>&#123;
    Object lock = <span class="hljs-keyword">new</span> Object();
    <span class="hljs-keyword">static</span> Object lockStatic = <span class="hljs-keyword">new</span> Object();
    <span class="hljs-keyword">static</span> <span class="hljs-keyword">int</span> i = <span class="hljs-number">0</span>;
    <span class="hljs-function"><span class="hljs-keyword">public</span> <span class="hljs-keyword">void</span> <span class="hljs-title">monitor</span><span class="hljs-params">()</span></span>&#123;
        <span class="hljs-keyword">synchronized</span> (lock) &#123;
            i++;
        &#125;
    &#125;
    <span class="hljs-function"><span class="hljs-keyword">public</span> <span class="hljs-keyword">void</span> <span class="hljs-title">monitor1</span><span class="hljs-params">()</span></span>&#123;
        <span class="hljs-keyword">synchronized</span> (lockStatic) &#123;
            i++;
        &#125;
    &#125;
    <span class="hljs-function"><span class="hljs-keyword">public</span> <span class="hljs-keyword">synchronized</span> <span class="hljs-keyword">void</span> <span class="hljs-title">monitor2</span><span class="hljs-params">()</span></span>&#123;
        i++;
    &#125;
&#125;</code></pre></div>

<p class="note note-info">
修饰代码块，指定加锁对象，对给定对象加锁，进入同步代码库前要获得给定对象的锁。代码块加锁需要用实例对象或者静态对象,看自己定义锁的范围标准。
</p>

<h3 id="1-4-如上代码查看同步方法的class文件"><a href="#1-4-如上代码查看同步方法的class文件" class="headerlink" title="1.4. 如上代码查看同步方法的class文件"></a>1.4. 如上代码查看同步方法的class文件</h3><div class="hljs code-wrapper"><pre><code class="hljs Java"><span class="hljs-function"><span class="hljs-keyword">public</span> <span class="hljs-keyword">void</span> <span class="hljs-title">monitor</span><span class="hljs-params">()</span></span>;
    descriptor: ()V
    flags: ACC_PUBLIC
    Code:
      stack=<span class="hljs-number">2</span>, locals=<span class="hljs-number">3</span>, args_size=<span class="hljs-number">1</span>
         <span class="hljs-number">0</span>: aload_0
         <span class="hljs-number">1</span>: getfield      #<span class="hljs-number">3</span>                  <span class="hljs-comment">// Field lock:Ljava/lang/Object;</span>
         <span class="hljs-number">4</span>: dup
         <span class="hljs-number">5</span>: astore_1
         <span class="hljs-number">6</span>: monitorenter
         <span class="hljs-number">7</span>: getstatic     #<span class="hljs-number">4</span>                  <span class="hljs-comment">// Field i:I</span>
        <span class="hljs-number">10</span>: iconst_1
        <span class="hljs-number">11</span>: iadd
        <span class="hljs-number">12</span>: putstatic     #<span class="hljs-number">4</span>                  <span class="hljs-comment">// Field i:I</span>
        <span class="hljs-number">15</span>: aload_1
        <span class="hljs-number">16</span>: monitorexit
        <span class="hljs-number">17</span>: goto          <span class="hljs-number">25</span>
        <span class="hljs-number">20</span>: astore_2
        <span class="hljs-number">21</span>: aload_1
        <span class="hljs-number">22</span>: monitorexit
        <span class="hljs-number">23</span>: aload_2
        <span class="hljs-number">24</span>: athrow
        <span class="hljs-number">25</span>: <span class="hljs-keyword">return</span>
        ...</code></pre></div>

<div class="hljs code-wrapper"><pre><code class="hljs Java"><span class="hljs-function"><span class="hljs-keyword">public</span> <span class="hljs-keyword">synchronized</span> <span class="hljs-keyword">void</span> <span class="hljs-title">monitor2</span><span class="hljs-params">()</span></span>;
descriptor: ()V
flags: ACC_PUBLIC, ACC_SYNCHRONIZED
Code:
  stack=<span class="hljs-number">0</span>, locals=<span class="hljs-number">1</span>, args_size=<span class="hljs-number">1</span>
     <span class="hljs-number">0</span>: <span class="hljs-keyword">return</span>
  LineNumberTable:
    line <span class="hljs-number">18</span>: <span class="hljs-number">0</span>
  LocalVariableTable:
    Start  Length  Slot  Name   Signature
        <span class="hljs-number">0</span>       <span class="hljs-number">1</span>     <span class="hljs-number">0</span>  <span class="hljs-keyword">this</span>   Lcom/springstudy/simplespring/SynchronizedTest;</code></pre></div>

<ul>
    <li><span class="label label-primary">monitor()</span> 方法,同步代码块的起始位置插入了 <span class="label label-primary">monitorenter</span> 指令，在同步代码块结束的位置插入了 <span class="label label-primary">monitorexit指令</span>。(JVM需要保证每一个monitorenter都有一个monitorexit与之相对应，但每个monitorexit不一定都有一个monitorenter)</li>
    <li><span class="label label-primary">monitor2()</span> 方法,翻译成普通的方法调用和返回指令，只是在其常量池中多了 <span class="label label-primary">ACC_SYNCHRONIZED</span> 标示符</li>
</ul>

<p class="note note-info">
JVM就是根据该标示符来实现方法的同步的：当方法调用时，调用指令将会检查方法的 ACC_SYNCHRONIZED 访问标志是否被设置，如果设置了，执行线程将先获取monitor，获取成功之后才能执行方法体，方法执行完后再释放 monitor。在方法执行期间，其他任何线程都无法再获得同一个 monitor 对象。其实本质上没有区别，只是方法的同步是一种隐式的方式来实现，无需通过字节码来完成。
monitorenter 和 monitorexit 指令是通过 monitor 对象实现的。
</p>

<h3 id="1-5-monitorenter"><a href="#1-5-monitorenter" class="headerlink" title="1.5. monitorenter"></a>1.5. monitorenter</h3><p class="note note-info">
每个对象都有一个监视器锁(monitor)与之对应。当monitor被占用时就会处于锁定状态，线程执行monitorenter指令时尝试获取monitor的所有权，过程如下：
</p>

<ul>
    <li>如果monitor的进入数为0，则该线程进入monitor，然后将进入数设置为1，该线程即为monitor的所有者.</li>
    <li>如果线程已经占有该monitor，只是重新进入，则进入monitor的进入数加1.</li>
    <li>如果其他线程已经占用了monitor，则该线程进入阻塞状态，直到monitor的进入数为0，再重新尝试获取monitor的所有权.</li>
</ul>

<h3 id="1-6-monitorexit"><a href="#1-6-monitorexit" class="headerlink" title="1.6. monitorexit"></a>1.6. monitorexit</h3><p class="note note-info">
执行monitorexit的线程必须是objectref所对应的monitor的所有者。<br>
指令执行时，monitor的进入数减1，如果减1后进入数为0，那线程退出monitor，不再是这个monitor的所有者。<br>
其他被这个monitor阻塞的线程可以尝试去获取这个monitor的所有权。
</p>

<p>通过这两个指令我们应该能很清楚的看出<span class="label label-primary">synchronized</span>的实现原理，<span class="label label-primary">synchronized</span>的语义底层是通过一个<span class="label label-primary">monitor</span>的对象来完成，其实wait/notify等方法也依赖于<span class="label label-primary">monitor</span>对象，这就是为什么只有在同步的块或者方法中才能调用wait/notify等方法，否则会抛出<span class="label label-primary">java.lang.IllegalMonitorStateException</span>的异常的原因。</p>

            </div>
            <hr>
            <div>
              <div class="post-metas mb-3">
                
                
                  <div class="post-meta">
                    <i class="iconfont icon-tags"></i>
                    
                      <a class="hover-with-bg" href="/tags/Java/">Java</a>
                    
                      <a class="hover-with-bg" href="/tags/%E9%94%81/">锁</a>
                    
                  </div>
                
              </div>
              
                <p class="note note-warning">
                  
                    本博客所有文章除特别声明外，均采用 <a target="_blank" href="https://creativecommons.org/licenses/by-sa/4.0/deed.zh" rel="nofollow noopener noopener">CC BY-SA 4.0 协议</a> ，转载请注明出处！
                  
                </p>
              
              
                <div class="post-prevnext">
                  <article class="post-prev col-6">
                    
                    
                      <a href="/2021/06/04/linux/Linux-jar/">
                        <i class="iconfont icon-arrowleft"></i>
                        <span class="hidden-mobile">Shell脚本部署jar包</span>
                        <span class="visible-mobile">上一篇</span>
                      </a>
                    
                  </article>
                  <article class="post-next col-6">
                    
                    
                      <a href="/2021/06/04/jvm/jvm3.0/">
                        <span class="hidden-mobile">Jvm 配置及优化</span>
                        <span class="visible-mobile">下一篇</span>
                        <i class="iconfont icon-arrowright"></i>
                      </a>
                    
                  </article>
                </div>
              
            </div>

            
              <!-- Comments -->
              <article class="comments" id="comments" lazyload>
                
                  
                
                
  <div id="valine"></div>
  <script type="text/javascript">
    Fluid.utils.loadComments('#valine', function() {
      Fluid.utils.createScript('https://cdn.jsdelivr.net/gh/HCLonely/Valine@latest/dist/Valine.min.js', function() {
        var options = Object.assign(
          {"appId":"BmWJPSifebgqliaA9sdhmII7-gzGzoHsz","appKey":"HvFu44h5vVRRYuQIg6uNJkKR","placeholder":"说点什么","path":"window.location.pathname","avatar":"retro","meta":["nick","mail","link"],"pageSize":10,"lang":"zh-CN","highlight":true,"recordIP":false,"serverURLs":"https://bmwjpsif.lc-cn-n1-shared.com","emojiCDN":null,"emojiMaps":null,"enableQQ":false,"requiredFields":[]},
          {
            el: "#valine",
            path: window.location.pathname,
            master: "",
            friends: "",
            tagMeta: ["博主","友人","访客"]
          }
        )
        new Valine(options);
      });
    });
  </script>
  <noscript>Please enable JavaScript to view the comments</noscript>


              </article>
            
          </article>
        </div>
      </div>
    </div>
    
      <div class="d-none d-lg-block col-lg-2 toc-container" id="toc-ctn">
        <div id="toc">
  <p class="toc-header"><i class="iconfont icon-list"></i>&nbsp;目录</p>
  <div class="toc-body" id="toc-body"></div>
</div>

      </div>
    
  </div>
</div>

<!-- Custom -->


    

    
      <a id="scroll-top-button" href="#" role="button">
        <i class="iconfont icon-arrowup" aria-hidden="true"></i>
      </a>
    

    
      <div class="modal fade" id="modalSearch" tabindex="-1" role="dialog" aria-labelledby="ModalLabel"
     aria-hidden="true">
  <div class="modal-dialog modal-dialog-scrollable modal-lg" role="document">
    <div class="modal-content">
      <div class="modal-header text-center">
        <h4 class="modal-title w-100 font-weight-bold">搜索</h4>
        <button type="button" id="local-search-close" class="close" data-dismiss="modal" aria-label="Close">
          <span aria-hidden="true">&times;</span>
        </button>
      </div>
      <div class="modal-body mx-3">
        <div class="md-form mb-5">
          <input type="text" id="local-search-input" class="form-control validate">
          <label data-error="x" data-success="v"
                 for="local-search-input">关键词</label>
        </div>
        <div class="list-group" id="local-search-result"></div>
      </div>
    </div>
  </div>
</div>
    

    
  </main>

  <footer class="text-center mt-5 py-3">
  <div class="footer-content">
     <a href="https://hexo.io" target="_blank" rel="nofollow noopener"><span>Hexo</span></a> <i class="iconfont icon-love"></i> <a href="https://github.com/fluid-dev/hexo-theme-fluid" target="_blank" rel="nofollow noopener"><span>Fluid</span></a> 
  </div>
  

  

  
</footer>


  <!-- SCRIPTS -->
  
  <script  src="https://cdn.jsdelivr.net/npm/nprogress@0.2.0/nprogress.min.js" ></script>
  <link  rel="stylesheet" href="https://cdn.jsdelivr.net/npm/nprogress@0.2.0/nprogress.min.css" />

  <script>
    NProgress.configure({"showSpinner":false,"trickleSpeed":100})
    NProgress.start()
    window.addEventListener('load', function() {
      NProgress.done();
    })
  </script>


<script  src="https://cdn.jsdelivr.net/npm/jquery@3.6.0/dist/jquery.min.js" ></script>
<script  src="https://cdn.jsdelivr.net/npm/bootstrap@4.6.0/dist/js/bootstrap.min.js" ></script>
<script  src="/js/events.js" ></script>
<script  src="/js/plugins.js" ></script>

<!-- Plugins -->


  
    <script  src="/js/img-lazyload.js" ></script>
  



  



  <script  src="https://cdn.jsdelivr.net/npm/tocbot@4.12.3/dist/tocbot.min.js" ></script>



  <script  src="https://cdn.jsdelivr.net/npm/@fancyapps/fancybox@3.5.7/dist/jquery.fancybox.min.js" ></script>



  <script  src="https://cdn.jsdelivr.net/npm/anchor-js@4.3.1/anchor.min.js" ></script>



  <script defer src="https://cdn.jsdelivr.net/npm/clipboard@2.0.8/dist/clipboard.min.js" ></script>



  <script  src="/js/local-search.js" ></script>






  <script  src="https://cdn.jsdelivr.net/npm/typed.js@2.0.12/lib/typed.min.js" ></script>
  <script>
    (function (window, document) {
      var typing = Fluid.plugins.typing;
      var title = document.getElementById('subtitle').title;
      
      typing(title)
      
    })(window, document);
  </script>














  
<script src="/js/diy/timeDate.js"></script>



<!-- 主题的启动项 保持在最底部 -->
<script  src="/js/boot.js" ></script>


</body>
</html>
